/*
 * @Description: 流程监控数据模型
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2022-10-12 15:38:02
 * @LastEditTime: 2022-11-24 16:57:37
 * @FilePath: \cscec-pms-admin\src\views\systemManage\workflowManagement\monitoring\model.js
 */

import { BUSINESS_SOURCE_MAP } from '@/config/businessConfig'
import OrgTreeSelect from '@/components/TreeSelect'
// 审批字段文本
const resultList = {
  0: '审核中',
  1: '审核通过',
  2: '审核不通过'
}
// 搜索列表
const searchOption = [
  {
    name: '事项名称',
    value: 'processName',
    type: 'input'
  },
  {
    name: '事项来源',
    value: 'taskSource',
    type: 'select',
    data: Object.keys(BUSINESS_SOURCE_MAP).map((key) => {
      return {
        label: BUSINESS_SOURCE_MAP[key],
        value: key
      }
    })
  },
  {
    name: '关键信息',
    value: 'keyword',
    type: 'input'
  },
  {
    name: '发起单位',
    valueKey: 'startOrgName',
    type: OrgTreeSelect,
    attrs: {
      isNeedOrgId: true
    }
  },
]
// 列表表头
const columns = [
  {
    title: '序号',
    width: 80,
    align: 'center',
    customRender: (text, record, index) => {
      return index + 1
    }
  },
  {
    title: '事项名称',
    dataIndex: 'name'
  },
  {
    title: '事项来源',
    dataIndex: 'taskSource',
    scopedSlots: { customRender: 'taskSource' }
  },
  {
    title: '发起人',
    dataIndex: 'startUser'
  },
  {
    title: '发起单位',
    dataIndex: 'startOrgName'
  },
  {
    title: '关键信息',
    dataIndex: 'keyword'
  },
  {
    title: '发起时间',
    dataIndex: 'startTime'
  },
  {
    title: '当前节点',
    dataIndex: 'taskName'
  },
  {
    title: '节点滞留时间',
    dataIndex: 'durationTime'
  },
  {
    title: '流程状态',
    dataIndex: 'result',
    scopedSlots: { customRender: 'result' }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    scopedSlots: { customRender: 'operation' },
  }
]
// 审批节点列表表头
const columns1 = [
  {
    title: '序号',
    width: 65,
    align: 'center',
    customRender: (text, record, index) => {
      return index + 1
    }
  },
  {
    title: '节点名称',
    dataIndex: 'taskName'
  },
  {
    title: '处理人',
    dataIndex: 'userName',
    scopedSlots: { customRender: 'userName' },
    width: 220
  },
  {
    title: '处理结果',
    dataIndex: 'processStatusName',
    width: 120
  },
  {
    title: '审批意见',
    dataIndex: 'opinions',
    scopedSlots: { customRender: 'opinions' },
    width: 200
  },
  {
    title: '开始时间',
    dataIndex: 'createTime',
    width: 120
  },
  {
    title: '滞留时间',
    dataIndex: 'durationInMillis',
    width: 120
  },
  {
    title: '结束时间',
    dataIndex: 'endTime',
    width: 120
  }
]
export {
  resultList,
  searchOption,
  columns,
  columns1
}